package com.edu.elasticsearch.thread;

import com.edu.elasticsearch.utils.ElasticSearchUtils;


public class WorkerThread implements Runnable {
	
	private Integer start;
    private Integer size;
 
    public WorkerThread(Integer start,Integer size){
        this.size = start*size;
        this.start = (start - 1) * size;
    }
 
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+" Start. index = "+start);
        processCommand();
        System.out.println(Thread.currentThread().getName()+" End. length = "+size);
    }
 
    private void processCommand() {
    	try {
			ElasticSearchUtils.write(start, size);
		} catch (Exception e) {
			e.printStackTrace();
		}
    }

}